package com.pshcp.patient.tool;

import cn.hutool.core.date.DateUtil;
import com.pshcp.common.enums.CommonStatusEnum;
import com.pshcp.domain.dto.PatientReserveRecordDTO;
import com.pshcp.patient.domain.searchreserve.ReserveListAO;

import java.util.Date;

public class SearchReserveTools {

    public static PatientReserveRecordDTO buildDTO(ReserveListAO reserveListAO){
        PatientReserveRecordDTO dto = new PatientReserveRecordDTO();
        dto.setStatus(CommonStatusEnum.INIT.getCode());
        dto.setPatientId(reserveListAO.getPatientId());
        //历史预约 当天之前的记录
        if(reserveListAO.getSearchType() != null && reserveListAO.getSearchType().intValue() == 1){
            dto.setSearchEndTime(DateUtil.offsetDay(new Date(), -1));
        }else{
            dto.setSearchStartTime(new Date());
        }
        return dto;
    }

}
